package com.systop.busafter.comment.mapper;
import com.systop.commer.pojo.Comment;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface CommentMapper {


    /*
     * 添加comment
     * comment comment
     * return int
     * csh
     *
     * */
    @Insert("insert into comment(comment_task_id,comment_fraction,comment_photo,comment_user_id,comment_driver_id,comment_remarks,comment_s) values (#{comment_task_id},#{comment_fraction},#{comment_photo},#{comment_user_id},#{comment_driver_id},#{comment_remarks},#{comment_s})")
    int insertcomment(Comment comment);


    /*
     * 查看全部
     * 无
     * list
     * csh
     * */
    @Select("select * from comment")
    List<Comment> commentListall();

    /*
     * 用id查看comment
     * comment_id  int
     * list
     * csh
     * */
    @Select("select * from comment where comment_id = #{comment_id}")
    List<Comment> commentIdlist(int comment_id);

    /*
     * 用id查看comment
     * comment_id  int
     * list
     * csh
     * */
    @Select("select * from comment where comment_id = #{comment_id}")
    Comment CommentId(int comment_id);

    /*
     * 删除comment
     * comment_id  int
     * return int
     * csh
     * */
    @Delete("delete from comment where comment_id=#{comment_id}")
    int deletecomment(int comment_id);

    /*
     * 用用户id查看comment
     * comment_user_id  int
     * list
     * csh
     * */
    @Select("select * from comment where comment_user_id = #{comment_user_id}")
    List<Comment> commentuseridall(int comment_user_id);

    /*
     * 用司机id查看comment
     * comment_driver_id   int
     * list
     * csh
     * */
    @Select("select * from comment where comment_driver_id = #{comment_driver_id}")
    List<Comment> commentdriveridall(int comment_driver_id);

    /*
     * 通过评论分数 和 用户id查comment
     *comment_fraction   comment_user_id
     * list
     * csh
     * */
    @Select("select * from comment where comment_fraction = #{comment_fraction} and comment_user_id = #{comment_user_id}")
    List<Comment> commentuserfraction(Comment comment);

    /*
     * 通过评论分数 和 司机id查
     *comment_fraction   comment_driver_id
     * list
     * csh
     * */
    @Select("select * from comment where comment_fraction = #{comment_fraction} and comment_driver_id = #{comment_driver_id}")
    List<Comment> commentdriverfraction(Comment comment);

}
